<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>完善资料</title>
    <link rel="stylesheet" href="__CDN__/assets/mobile/common/mobiscroll.2.13.2.css">
    <link rel="stylesheet" href="__CDN__/assets/mobile/common/mPicker.css">
    <link rel="stylesheet" href="__CDN__/assets/mobile/common/base.css">
    <link rel="stylesheet" href="__CDN__/assets/mobile/css/perfect-info.css">
</head>
<body>
<header>
    <i class="go-back" onclick="goToIndex()">
        <img src="__CDN__/assets/mobile/img/go-back.png" alt="">
    </i>
    <span class="skip">跳过</span>
    <h1 class="perfect-title">完善信息</h1>
</header>
<ul class="perfect-content">
    <li>
        <span>昵称</span>
        <input type="text" class="nickname">
    </li>
    <li data-role="fieldcontain" class="demo-select">
        <span>性别</span>
        <select id="city" class="demo-test-select" data-role="none">
            <option value="1" selected="selected">男</option>
            <option value="2">女</option>
        </select>
    </li>
    <li>
        <span>出生日期</span>
        <input type="text" id="demo3">
    </li>
    <li>
        <span>联系QQ</span>
        <input type="text" id="qq">
    </li>
    <li>
        <span>地区</span>
        <input type="text" class="select-value" value="河南 郑州">
    </li>
</ul>
<div class="perfect-btn">
    <a href="javascript:;" class="a-submit">完成</a>
</div>
</body>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/vue.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/layer/layer.js"></script>
<script type="text/javascript">
    function goToIndex() {
        perfectInfo(1);
    }
    function perfectInfo(from){
        var nickname = $('.nickname').val();
        var gender = $('.demo-test-select').val();
        var birthday = $('#demo3').val();
        var area = '110100';
        // var area = $('.select-value').val();
        var qq = $('#qq').val();
        var data = {
            'nickname': nickname,
            'gender': gender,
            'birthday': birthday,
            'area': area,
            'qq': qq,
        };
        $.ajax({
            type        : "POST",
            url         : '',
            data        : data,
            datatype    : "json",//"xml", "html", "script", "json", "jsonp", "text".
            success     : function(data){
                if(data.code == 1){
                    if(from){
                        window.location.href='index';
                    }else{
                        layer.msg(data.message);
                        setTimeout(function(){window.location.href='index';},1000);
                    }
                }else{
                    wordcode();
                    layer.msg(data.message);
                }
            },
            error      : function(){
                wordcode();
                layer.msg('未知错误请重试！');
            }
        });
    }
    $(function () {
        // 提交
        $('.a-submit').click(function () {
            perfectInfo();
        });
        $('.skip').click(function(){
            perfectInfo(1);
        });
    });

</script>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/mobiscroll.2.13.2.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/mPicker.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/common/common.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/lib/opt.js"></script>
<script type="text/javascript" src="__CDN__/assets/mobile/js/perfect-info.js"></script>
</html>